<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.4.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/myblog/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/myblog/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/myblog/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/myblog/images/logo.svg" color="#222">

<link rel="stylesheet" href="/myblog/css/main.css">


<link rel="stylesheet" href="/myblog/lib/font-awesome/css/all.min.css">
  <link rel="stylesheet" href="/myblog/lib/pace/pace-theme-minimal.min.css">
  <script src="/myblog/lib/pace/pace.min.js"></script>

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"gao-qianwei.gitee.io","root":"/myblog/","scheme":"Gemini","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},"path":"search.xml"};
  </script>

  <meta name="description" content="&amp;ensp;&amp;ensp;&amp;ensp;&amp;ensp;本文主要总结了NameNode、SecondaryNameNode和DataNode的工作机制。">
<meta property="og:type" content="article">
<meta property="og:title" content="HDFS的各个节点工作机制">
<meta property="og:url" content="https://gao-qianwei.gitee.io/myblog/2021/05/22/Hadoop%E4%B9%8BHDFS%EF%BC%9AHDFS%E7%9A%84%E5%90%84%E4%B8%AA%E8%8A%82%E7%82%B9%E5%B7%A5%E4%BD%9C%E6%9C%BA%E5%88%B6/index.html">
<meta property="og:site_name" content="学无止境">
<meta property="og:description" content="&amp;ensp;&amp;ensp;&amp;ensp;&amp;ensp;本文主要总结了NameNode、SecondaryNameNode和DataNode的工作机制。">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://gao-qianwei.gitee.io/myblog/myblog/2021/05/22/Hadoop%E4%B9%8BHDFS%EF%BC%9AHDFS%E7%9A%84%E5%90%84%E4%B8%AA%E8%8A%82%E7%82%B9%E5%B7%A5%E4%BD%9C%E6%9C%BA%E5%88%B6/1.png">
<meta property="og:image" content="https://gao-qianwei.gitee.io/myblog/myblog/2021/05/22/Hadoop%E4%B9%8BHDFS%EF%BC%9AHDFS%E7%9A%84%E5%90%84%E4%B8%AA%E8%8A%82%E7%82%B9%E5%B7%A5%E4%BD%9C%E6%9C%BA%E5%88%B6/2.png">
<meta property="og:image" content="https://gao-qianwei.gitee.io/myblog/myblog/2021/05/22/Hadoop%E4%B9%8BHDFS%EF%BC%9AHDFS%E7%9A%84%E5%90%84%E4%B8%AA%E8%8A%82%E7%82%B9%E5%B7%A5%E4%BD%9C%E6%9C%BA%E5%88%B6/3.png">
<meta property="article:published_time" content="2021-05-22T08:19:27.047Z">
<meta property="article:modified_time" content="2021-05-22T08:25:19.867Z">
<meta property="article:author" content="高乾威">
<meta property="article:tag" content="数据研发">
<meta property="article:tag" content="Hadoop">
<meta property="article:tag" content="HDFS">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://gao-qianwei.gitee.io/myblog/myblog/2021/05/22/Hadoop%E4%B9%8BHDFS%EF%BC%9AHDFS%E7%9A%84%E5%90%84%E4%B8%AA%E8%8A%82%E7%82%B9%E5%B7%A5%E4%BD%9C%E6%9C%BA%E5%88%B6/1.png">

<link rel="canonical" href="https://gao-qianwei.gitee.io/myblog/2021/05/22/Hadoop%E4%B9%8BHDFS%EF%BC%9AHDFS%E7%9A%84%E5%90%84%E4%B8%AA%E8%8A%82%E7%82%B9%E5%B7%A5%E4%BD%9C%E6%9C%BA%E5%88%B6/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>HDFS的各个节点工作机制 | 学无止境</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/myblog/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">学无止境</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="main-menu menu">
        <li class="menu-item menu-item-home">

    <a href="/myblog/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a>

  </li>
        <li class="menu-item menu-item-about">

    <a href="/myblog/about/" rel="section"><i class="fa fa-user fa-fw"></i>关于</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/myblog/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/myblog/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/myblog/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a>

  </li>
        <li class="menu-item menu-item-links">

    <a href="/myblog/links/" rel="section"><i class="fa fa-link fa-fw"></i>友链</a>

  </li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup">
        <div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div id="search-result">
  <div id="no-result">
    <i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>
  </div>
</div>

    </div>
  </div>

</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://gao-qianwei.gitee.io/myblog/2021/05/22/Hadoop%E4%B9%8BHDFS%EF%BC%9AHDFS%E7%9A%84%E5%90%84%E4%B8%AA%E8%8A%82%E7%82%B9%E5%B7%A5%E4%BD%9C%E6%9C%BA%E5%88%B6/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/myblog/images/avatar.png">
      <meta itemprop="name" content="高乾威">
      <meta itemprop="description" content="报我楼成秋望月，把君诗读夜回灯">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="学无止境">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          HDFS的各个节点工作机制
        </h1>

        <div class="post-meta">

          
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>
              

              <time title="创建时间：2021-05-22 16:19:27 / 修改时间：16:25:19" itemprop="dateCreated datePublished" datetime="2021-05-22T16:19:27+08:00">2021-05-22</time>
            </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/myblog/categories/%E6%95%B0%E6%8D%AE%E7%A0%94%E5%8F%91/" itemprop="url" rel="index"><span itemprop="name">数据研发</span></a>
                </span>
                  ，
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/myblog/categories/%E6%95%B0%E6%8D%AE%E7%A0%94%E5%8F%91/Hadoop/" itemprop="url" rel="index"><span itemprop="name">Hadoop</span></a>
                </span>
                  ，
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/myblog/categories/%E6%95%B0%E6%8D%AE%E7%A0%94%E5%8F%91/Hadoop/HDFS/" itemprop="url" rel="index"><span itemprop="name">HDFS</span></a>
                </span>
            </span>

          
            <span class="post-meta-item" title="阅读次数" id="busuanzi_container_page_pv" style="display: none;">
              <span class="post-meta-item-icon">
                <i class="fa fa-eye"></i>
              </span>
              <span class="post-meta-item-text">阅读次数：</span>
              <span id="busuanzi_value_page_pv"></span>
            </span>
            <span class="post-meta-divider">|</span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <p>&ensp;&ensp;&ensp;&ensp;本文主要总结了NameNode、SecondaryNameNode和DataNode的工作机制。</p>
<span id="more"></span>

<h3 id="一、NameNode和SecondaryNameNode"><a href="#一、NameNode和SecondaryNameNode" class="headerlink" title="一、NameNode和SecondaryNameNode"></a>一、NameNode和SecondaryNameNode</h3><h4 id="1-1-NameNode和Secondary-NameNode工作机制"><a href="#1-1-NameNode和Secondary-NameNode工作机制" class="headerlink" title="1.1 NameNode和Secondary NameNode工作机制"></a>1.1 NameNode和Secondary NameNode工作机制</h4><img src="/myblog/myblog/2021/05/22/Hadoop%E4%B9%8BHDFS%EF%BC%9AHDFS%E7%9A%84%E5%90%84%E4%B8%AA%E8%8A%82%E7%82%B9%E5%B7%A5%E4%BD%9C%E6%9C%BA%E5%88%B6/1.png" alt="image-20210520205518555" style="zoom:80%;">

<p>第一阶段：NameNode启动</p>
<ol>
<li> 第一次启动NameNode格式化后，创建fsimage和edits文件。如果不是第一次启动，直接加载编辑日志和镜像文件到内存。</li>
<li> 客户端对元数据进行增删改的请求</li>
<li> namenode记录操作日志，更新滚动日志。</li>
<li> namenode在内存中对数据进行增删改</li>
</ol>
<p>第二阶段：Secondary NameNode工作</p>
<ol>
<li> Secondary NameNode询问namenode是否需要checkpoint，直接带回namenode是否检查结果。</li>
<li> Secondary NameNode请求执行checkpoint。</li>
<li> namenode滚动正在写的edits日志</li>
<li> 将滚动前的编辑日志和镜像文件拷贝到Secondary NameNode</li>
<li> Secondary NameNode加载编辑日志和镜像文件到内存，并合并。</li>
<li> 生成新的镜像文件fsimage.chkpoint</li>
<li> 拷贝fsimage.chkpoint到namenode</li>
<li> namenode将fsimage.chkpoint重新命名成fsimage</li>
</ol>
<h4 id="1-2-Fsimage和Edits"><a href="#1-2-Fsimage和Edits" class="headerlink" title="1.2 Fsimage和Edits"></a>1.2 Fsimage和Edits</h4><blockquote>
<p>思考：NameNode 中的元数据是存储在哪里的？</p>
<p>首先，我们做个假设，如果存储在 NameNode 节点的磁盘中，因为经常需要进行随机访 问，还有响应客户请求，必然是效率过低。因此，元数据需要存放在内存中。但如果只存在 内存中，一旦断电，元数据丢失，整个集群就无法工作了。因此产生在磁盘中备份元数据的 FsImage。 这样又会带来新的问题，当在内存中的元数据更新时，如果同时更新 FsImage，就会导 致效率过低，但如果不更新，就会发生一致性问题，一旦 NameNode 节点断电，就会产生数 据丢失。因此，引入 Edits 文件（只进行追加操作，效率很高）。每当元数据有更新或者添 加元数据时，修改内存中的元数据并追加到 Edits 中。这样，一旦 NameNode 节点断电，可 以通过 FsImage 和 Edits 的合并，合成元数据。 但是，如果长时间添加数据到 Edits 中，会导致该文件数据过大，效率降低，而且一旦 断电，恢复元数据需要的时间过长。因此，需要定期进行 FsImage 和 Edits 的合并，如果这 个操作由NameNode节点完成，又会效率过低。因此，引入一个新的节点SecondaryNamenode， 专门用于 FsImage 和 Edits 的合并。</p>
</blockquote>
<h5 id="1-2-1概念"><a href="#1-2-1概念" class="headerlink" title="1.2.1概念"></a>1.2.1概念</h5><p>Namenode被格式化之后,将在 opt/module/hadoop-3.].3/ data/tmp/dfs/name/curren目录中产生如下文件</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">fsimage 0C00000CC0CO0O0COCO</span><br><span class="line">fsimage 0C00000CC000000[OC0 md5</span><br><span class="line">seen txid</span><br><span class="line">VERSICN</span><br></pre></td></tr></table></figure>

<p>&ensp;&ensp;&ensp;&ensp;(1) Fsimage.文件:HDFS文件系统元数据的一个永久性的检査点,其中包含HDFS文件系统的所有目<br>录和文件 inode的序列化信息。</p>
<p>&ensp;&ensp;&ensp;&ensp;(2) Edits文件:存放IDFS文件系统的所有更新操作的路径,文件系统客户端执行的所有写操作首先<br>会被记录到 Edits文件中</p>
<p>&ensp;&ensp;&ensp;&ensp;(3) scen txid文件保存的是一个数字,就是最后一个cdis的数字</p>
<p>&ensp;&ensp;&ensp;&ensp;(4)每次 Namenodef启动的时候都会将 Simac文件读入内存,加载Edis里面的更新操作,保证内存<br>中的元数据信息是最新的、同步的,可以看成 Namenode启动的时候就将 Fsimage和Fdis文件进行了合并</p>
<h5 id="1-2-2使用oiv和oev命令查看fsimage和edits文件"><a href="#1-2-2使用oiv和oev命令查看fsimage和edits文件" class="headerlink" title="1.2.2使用oiv和oev命令查看fsimage和edits文件"></a>1.2.2使用oiv和oev命令查看fsimage和edits文件</h5><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash"> 1.查看oiv和oev命令</span></span><br><span class="line">  hdfs</span><br><span class="line">  oiv                  apply the offline fsimage viewer to an fsimage</span><br><span class="line">  oev                  apply the offline edits viewer to an edits file</span><br><span class="line"><span class="meta">#</span><span class="bash"> 2.oiv查看fsimage文件</span></span><br><span class="line"><span class="meta">#</span><span class="bash"> 基本语法</span></span><br><span class="line">  hdfs oiv -p 文件类型 -i镜像文件 -o 转换后文件输出路径</span><br><span class="line"><span class="meta">#</span><span class="bash"> 案例实操</span></span><br><span class="line">  hdfs oiv -p XML -i fsimage_0000000000000000023 -o /opt/install/hadoop/fsimage.xml</span><br><span class="line">  cat opt/install/hadoop/fsimage.xml</span><br><span class="line">  将显示的xml文件内容拷贝到eclipse中创建的xml文件中，并格式化。</span><br><span class="line"><span class="meta">#</span><span class="bash"> 3.oev查看edits文件</span></span><br><span class="line"><span class="meta">#</span><span class="bash"> 基本语法</span></span><br><span class="line">  hdfs oev -p 文件类型 -i编辑日志 -o 转换后文件输出路径</span><br><span class="line"><span class="meta">#</span><span class="bash"> 案例实操</span></span><br><span class="line">  hdfs oev -p XML -i </span><br><span class="line">  edits_0000000000000000012-0000000000000000013 -o /opt/install/hadoop/edits.xml</span><br><span class="line"></span><br><span class="line">  cat /opt/install/hadoop/edits.xml</span><br><span class="line">  将显示的xml文件内容拷贝到eclipse中创建的xml文件中，并格式化。</span><br><span class="line">1234567891011121314151617181920</span><br></pre></td></tr></table></figure>

<h4 id="1-3-checkpoint时间设置"><a href="#1-3-checkpoint时间设置" class="headerlink" title="1.3 checkpoint时间设置"></a>1.3 checkpoint时间设置</h4><p>&ensp;&ensp;&ensp;&ensp;（1）通常情况下，SecondaryNameNode每隔一小时执行一次。</p>
<p>&ensp;&ensp;&ensp;&ensp;（2）一分钟检查一次操作次数，当操作次数达到1百万时，SecondaryNameNode执行一次。</p>
<h3 id="二、DataNode"><a href="#二、DataNode" class="headerlink" title="二、DataNode"></a>二、DataNode</h3><h4 id="2-1-DataNode-工作机制"><a href="#2-1-DataNode-工作机制" class="headerlink" title="2.1 DataNode 工作机制"></a>2.1 DataNode 工作机制</h4><img src="/myblog/myblog/2021/05/22/Hadoop%E4%B9%8BHDFS%EF%BC%9AHDFS%E7%9A%84%E5%90%84%E4%B8%AA%E8%8A%82%E7%82%B9%E5%B7%A5%E4%BD%9C%E6%9C%BA%E5%88%B6/2.png" alt="image-20210520205906636" style="zoom:80%;">

<p>&ensp;&ensp;&ensp;&ensp;（1）一个数据块在 DataNode 上以文件形式存储在磁盘上，包括两个文件，一个是数据本身，一个是元数据包括数据块的长度，块数据的校验和，以及时间戳。 </p>
<p>&ensp;&ensp;&ensp;&ensp;（2）DataNode 启动后向 NameNode 注册，通过后，周期性（6 小时）的向 NameNode 上 报所有的块信息。 DN 向 NN 汇报当前解读信息的时间间隔，默认 6 小时；DN 扫描自己节点块信息列表的时间，默认 6 小时 ;</p>
<p>&ensp;&ensp;&ensp;&ensp;（3）心跳是每 3 秒一次，心跳返回结果带有 NameNode 给该 DataNode 的命令如复制块 数据到另一台机器，或删除某个数据块。如果超过 10 分钟没有收到某个 DataNode 的心跳， 则认为该节点不可用。 </p>
<p>&ensp;&ensp;&ensp;&ensp;（4）集群运行中可以安全加入和退出一些机器。</p>
<h4 id="2-2-数据完整性"><a href="#2-2-数据完整性" class="headerlink" title="2.2 数据完整性"></a>2.2 数据完整性</h4><p>&ensp;&ensp;&ensp;&ensp;如下是 DataNode 节点保证数据完整性的方法。 </p>
<ol>
<li> 当 DataNode 读取 Block 的时候，它会计算 CheckSum。 </li>
<li> 如果计算后的 CheckSum，与 Block 创建时值不一样，说明 Block 已经损坏。</li>
<li> Client 读取其他 DataNode 上的 Block。 </li>
<li> 常见的校验算法 crc（32），md5（128），sha1（160） </li>
<li> DataNode 在其文件创建后周期验证 CheckSum。</li>
</ol>
<h4 id="2-3-掉线时限参数设置"><a href="#2-3-掉线时限参数设置" class="headerlink" title="2.3 掉线时限参数设置"></a>2.3 掉线时限参数设置</h4><img src="/myblog/myblog/2021/05/22/Hadoop%E4%B9%8BHDFS%EF%BC%9AHDFS%E7%9A%84%E5%90%84%E4%B8%AA%E8%8A%82%E7%82%B9%E5%B7%A5%E4%BD%9C%E6%9C%BA%E5%88%B6/3.png" alt="image-20210520210251978" style="zoom:80%;">



<p><a target="_blank" rel="noopener" href="https://www.bilibili.com/video/BV1Qp4y1n7EN?p=1">尚硅谷丨大数据Hadoop 3.x（2021全新升级/部署+源码+实战）_哔哩哔哩 (゜-゜)つロ 干杯~-bilibili</a></p>
<p><a target="_blank" rel="noopener" href="https://blog.csdn.net/qq_45069279/article/details/114527428">(4条消息) 太强了， SecondaryNameNode 的工作流程_苜苜的烂笔头的博客-CSDN博客</a></p>

    </div>

    
    
    

      <footer class="post-footer">
          <div class="post-tags">
              <a href="/myblog/tags/%E6%95%B0%E6%8D%AE%E7%A0%94%E5%8F%91/" rel="tag"># 数据研发</a>
              <a href="/myblog/tags/Hadoop/" rel="tag"># Hadoop</a>
              <a href="/myblog/tags/HDFS/" rel="tag"># HDFS</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/myblog/2021/05/15/%E8%AF%BE%E5%A0%82%E5%AD%A6%E4%B9%A0%E4%B9%8B%E6%95%B0%E6%8D%AE%E7%A7%91%E5%AD%A6%E5%AF%BC%E8%AE%BA%EF%BC%9A%E6%95%B0%E6%8D%AE%E9%85%B7%E5%AE%A2%E4%B9%A0%E9%A2%98%E7%9F%A5%E8%AF%86%E6%95%B4%E7%90%86/" rel="prev" title="数据酷客习题知识整理">
      <i class="fa fa-chevron-left"></i> 数据酷客习题知识整理
    </a></div>
      <div class="post-nav-item">
    <a href="/myblog/2021/05/22/Hadoop%E4%B9%8BHDFS%EF%BC%9AHDFS%E8%AF%BB%E5%86%99/" rel="next" title="HDFS读写">
      HDFS读写 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#%E4%B8%80%E3%80%81NameNode%E5%92%8CSecondaryNameNode"><span class="nav-text">一、NameNode和SecondaryNameNode</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#1-1-NameNode%E5%92%8CSecondary-NameNode%E5%B7%A5%E4%BD%9C%E6%9C%BA%E5%88%B6"><span class="nav-text">1.1 NameNode和Secondary NameNode工作机制</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#1-2-Fsimage%E5%92%8CEdits"><span class="nav-text">1.2 Fsimage和Edits</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#1-2-1%E6%A6%82%E5%BF%B5"><span class="nav-text">1.2.1概念</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#1-2-2%E4%BD%BF%E7%94%A8oiv%E5%92%8Coev%E5%91%BD%E4%BB%A4%E6%9F%A5%E7%9C%8Bfsimage%E5%92%8Cedits%E6%96%87%E4%BB%B6"><span class="nav-text">1.2.2使用oiv和oev命令查看fsimage和edits文件</span></a></li></ol></li><li class="nav-item nav-level-4"><a class="nav-link" href="#1-3-checkpoint%E6%97%B6%E9%97%B4%E8%AE%BE%E7%BD%AE"><span class="nav-text">1.3 checkpoint时间设置</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E4%BA%8C%E3%80%81DataNode"><span class="nav-text">二、DataNode</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#2-1-DataNode-%E5%B7%A5%E4%BD%9C%E6%9C%BA%E5%88%B6"><span class="nav-text">2.1 DataNode 工作机制</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#2-2-%E6%95%B0%E6%8D%AE%E5%AE%8C%E6%95%B4%E6%80%A7"><span class="nav-text">2.2 数据完整性</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#2-3-%E6%8E%89%E7%BA%BF%E6%97%B6%E9%99%90%E5%8F%82%E6%95%B0%E8%AE%BE%E7%BD%AE"><span class="nav-text">2.3 掉线时限参数设置</span></a></li></ol></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="高乾威"
      src="/myblog/images/avatar.png">
  <p class="site-author-name" itemprop="name">高乾威</p>
  <div class="site-description" itemprop="description">报我楼成秋望月，把君诗读夜回灯</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/myblog/archives/">
        
          <span class="site-state-item-count">91</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/myblog/categories/">
          
        <span class="site-state-item-count">27</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/myblog/tags/">
          
        <span class="site-state-item-count">59</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
        <a href="http://github.com/GaoQianwei" title="GitHub → http:&#x2F;&#x2F;github.com&#x2F;GaoQianwei" rel="noopener" target="_blank">GitHub</a>
      </span>
      <span class="links-of-author-item">
        <a href="mailto:2966807184@qq.com" title="E-Mail → mailto:2966807184@qq.com" rel="noopener" target="_blank">E-Mail</a>
      </span>
      <span class="links-of-author-item">
        <a href="https://www.zhihu.com/people/xue-wu-zhi-jing-75-22" title="知乎 → https:&#x2F;&#x2F;www.zhihu.com&#x2F;people&#x2F;xue-wu-zhi-jing-75-22" rel="noopener" target="_blank">知乎</a>
      </span>
      <span class="links-of-author-item">
        <a href="https://blog.csdn.net/weixin_45341339" title="CSDN → https:&#x2F;&#x2F;blog.csdn.net&#x2F;weixin_45341339" rel="noopener" target="_blank">CSDN</a>
      </span>
  </div>



      </div><div>
  <canvas id="canvasDiyBlock" style="width:60%;">当前浏览器不支持canvas，请更换浏览器后再试</canvas>
<script src="/myblog/js/custom/clock.js"></script>

</div>


    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 2021-04 到 
  <span itemprop="copyrightYear">2022</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">高乾威</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Gemini</a> 强力驱动
  </div>

<span class="post-meta-divider">|</span>

<div class="theme-info">
  <div class="powered-by"></div>
  <span class="post-count">全站共 117.2k 字</span>
</div>

<span class="post-meta-divider">|</span>
        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
</div>








      </div>
    </footer>
  </div>

  
  <script src="/myblog/lib/anime.min.js"></script>
  <script src="/myblog/lib/velocity/velocity.min.js"></script>
  <script src="/myblog/lib/velocity/velocity.ui.min.js"></script>

<script src="/myblog/js/utils.js"></script>

<script src="/myblog/js/motion.js"></script>


<script src="/myblog/js/schemes/pisces.js"></script>


<script src="/myblog/js/next-boot.js"></script>


  <script defer src="/myblog/lib/three/three.min.js"></script>
    <script defer src="/myblog/lib/three/canvas_lines.min.js"></script>


  




  
<script src="/myblog/js/local-search.js"></script>













  

  

</body>
</html>
